/*
 * @Author: DaHuaZhuXi
 * @Date: 2020-09-30 20:39:07
 * @LastEditTime: 2020-12-07 20:57:38
 * @LastEditors: DaHuaZhuXi
 * @Description: vuex
 */
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    gold: 0, 
    date: 0,
    food: 0,
    tool: 0,
    medication: 0,
    arrow: 0,

    // 迷宫数据
    maze:{
      mapDatas:null,
      placeId:null
    }
  },
  mutations: {
    updateStore(state, val) {
      if(!game.curSave) return;
      state.date = game.curSave.date;
      state.gold = game.curSave.gold;
      state.food = game.curSave.food;
      state.tool = game.curSave.tool;
      state.medication = game.curSave.medication;
      state.arrow = game.curSave.arrow;
    },

    clearMazeData(state){
      state.maze = {
        mapDatas:null,
        placeId:null
      }
    },

    updateMazeData(state, vueComponent) {
      state.maze.mapDatas = vueComponent.mapDatas;
      state.maze.placeId = vueComponent.placeId;
    },
  },
  actions: {},
  modules: {}
})
